// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*! 
 * @file SensorCombined.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace { char dummy; }
#endif

#include "SensorCombined.h"

#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>

SensorCombined::SensorCombined()
{
    m_timestamp = 0;

    m_gyro_integral_dt = 0.0;
    m_accelerometer_timestamp_relative = 0;

    m_accelerometer_integral_dt = 0.0;
    m_magnetometer_timestamp_relative = 0;

    m_baro_timestamp_relative = 0;
    m_baro_alt_meter = 0.0;
    m_baro_temp_celcius = 0.0;
}

SensorCombined::~SensorCombined()
{
}

SensorCombined::SensorCombined(const SensorCombined &x)
{
    m_timestamp = x.m_timestamp;
    m_gyro_rad = x.m_gyro_rad;
    m_gyro_integral_dt = x.m_gyro_integral_dt;
    m_accelerometer_timestamp_relative = x.m_accelerometer_timestamp_relative;
    m_accelerometer_m_s2 = x.m_accelerometer_m_s2;
    m_accelerometer_integral_dt = x.m_accelerometer_integral_dt;
    m_magnetometer_timestamp_relative = x.m_magnetometer_timestamp_relative;
    m_magnetometer_ga = x.m_magnetometer_ga;
    m_baro_timestamp_relative = x.m_baro_timestamp_relative;
    m_baro_alt_meter = x.m_baro_alt_meter;
    m_baro_temp_celcius = x.m_baro_temp_celcius;
}

SensorCombined::SensorCombined(SensorCombined &&x)
{
    m_timestamp = x.m_timestamp;
    m_gyro_rad = std::move(x.m_gyro_rad);
    m_gyro_integral_dt = x.m_gyro_integral_dt;
    m_accelerometer_timestamp_relative = x.m_accelerometer_timestamp_relative;
    m_accelerometer_m_s2 = std::move(x.m_accelerometer_m_s2);
    m_accelerometer_integral_dt = x.m_accelerometer_integral_dt;
    m_magnetometer_timestamp_relative = x.m_magnetometer_timestamp_relative;
    m_magnetometer_ga = std::move(x.m_magnetometer_ga);
    m_baro_timestamp_relative = x.m_baro_timestamp_relative;
    m_baro_alt_meter = x.m_baro_alt_meter;
    m_baro_temp_celcius = x.m_baro_temp_celcius;
}

SensorCombined& SensorCombined::operator=(const SensorCombined &x)
{
    m_timestamp = x.m_timestamp;
    m_gyro_rad = x.m_gyro_rad;
    m_gyro_integral_dt = x.m_gyro_integral_dt;
    m_accelerometer_timestamp_relative = x.m_accelerometer_timestamp_relative;
    m_accelerometer_m_s2 = x.m_accelerometer_m_s2;
    m_accelerometer_integral_dt = x.m_accelerometer_integral_dt;
    m_magnetometer_timestamp_relative = x.m_magnetometer_timestamp_relative;
    m_magnetometer_ga = x.m_magnetometer_ga;
    m_baro_timestamp_relative = x.m_baro_timestamp_relative;
    m_baro_alt_meter = x.m_baro_alt_meter;
    m_baro_temp_celcius = x.m_baro_temp_celcius;
    
    return *this;
}

SensorCombined& SensorCombined::operator=(SensorCombined &&x)
{
    m_timestamp = x.m_timestamp;
    m_gyro_rad = std::move(x.m_gyro_rad);
    m_gyro_integral_dt = x.m_gyro_integral_dt;
    m_accelerometer_timestamp_relative = x.m_accelerometer_timestamp_relative;
    m_accelerometer_m_s2 = std::move(x.m_accelerometer_m_s2);
    m_accelerometer_integral_dt = x.m_accelerometer_integral_dt;
    m_magnetometer_timestamp_relative = x.m_magnetometer_timestamp_relative;
    m_magnetometer_ga = std::move(x.m_magnetometer_ga);
    m_baro_timestamp_relative = x.m_baro_timestamp_relative;
    m_baro_alt_meter = x.m_baro_alt_meter;
    m_baro_temp_celcius = x.m_baro_temp_celcius;
    
    return *this;
}

size_t SensorCombined::getMaxCdrSerializedSize(size_t current_alignment)
{
    size_t initial_alignment = current_alignment;
            
    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);

    current_alignment += ((3) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += ((3) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += ((3) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    return current_alignment - initial_alignment;
}

size_t SensorCombined::getCdrSerializedSize(const SensorCombined& data, size_t current_alignment)
{
    size_t initial_alignment = current_alignment;
            
    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);

    current_alignment += ((3) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += ((3) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += ((3) * 4) + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);

    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    return current_alignment - initial_alignment;
}

void SensorCombined::serialize(eprosima::fastcdr::Cdr &scdr) const
{
    scdr << m_timestamp;

    scdr << m_gyro_rad;

    scdr << m_gyro_integral_dt;

    scdr << m_accelerometer_timestamp_relative;

    scdr << m_accelerometer_m_s2;

    scdr << m_accelerometer_integral_dt;

    scdr << m_magnetometer_timestamp_relative;

    scdr << m_magnetometer_ga;

    scdr << m_baro_timestamp_relative;

    scdr << m_baro_alt_meter;

    scdr << m_baro_temp_celcius;

}

void SensorCombined::deserialize(eprosima::fastcdr::Cdr &dcdr)
{
    dcdr >> m_timestamp;
    dcdr >> m_gyro_rad;
    dcdr >> m_gyro_integral_dt;
    dcdr >> m_accelerometer_timestamp_relative;
    dcdr >> m_accelerometer_m_s2;
    dcdr >> m_accelerometer_integral_dt;
    dcdr >> m_magnetometer_timestamp_relative;
    dcdr >> m_magnetometer_ga;
    dcdr >> m_baro_timestamp_relative;
    dcdr >> m_baro_alt_meter;
    dcdr >> m_baro_temp_celcius;
}

size_t SensorCombined::getKeyMaxCdrSerializedSize(size_t current_alignment)
{
	size_t current_align = current_alignment;
            












    return current_align;
}

bool SensorCombined::isKeyDefined()
{
    return false;
}

void SensorCombined::serializeKey(eprosima::fastcdr::Cdr &scdr) const
{
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
}